Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use non-primary columns in crossref tables #1994

Merged
merged 8 commits into from
Mar 29, 2024

Conversation

vol4onok
Copy link
Contributor

@vol4onok vol4onok commented Mar 20, 2024

Hi guys,

Not sure what was the reason for the change, but in Propel1 it was not mandatory to make the crossref table foreign keys also primary keys. It was handy when the crossref table relation had to be referenced further elsewhere.

I don't see any negative effects enabling this, but please correct me if I'm wrong.

Here is a pseudo-example:

<table name="user_group" isCrossRef="true">
  <column name="id" type="integer" primaryKey="true" required="true" />
  <column name="user_id" type="integer"/>
  <column name="group_id" type="integer"/>
  <foreign-key foreignTable="user">
    <reference local="user_id" foreign="id"/>
  </foreign-key>
  <foreign-key foreignTable="group">
    <reference local="group_id" foreign="id"/>
  </foreign-key>
</table>

<table name="user_group_logs">
    <column name="id"type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="user_group_id" type="INTEGER" />
    <column name="log" type="VARCHAR" />
    <foreign-key foreignTable="user_group">
        <reference local="user_group_id" foreign="id" />
    </foreign-key>
</table>

#1559

@PhilinTv
Copy link
Contributor

@vol4onok thanks for coming back to this long lasting PR!

  1. Could you please state what use-cases will be opened with this change?
  2. Please provide a relevant test(s) to cover this new use case.

@vol4onok
Copy link
Contributor Author

@PhilinTv It was taken here #1559. I covered this improvement.
I needed to understand what this fix does In tests everything is clear. This fix didn't work for example in desription.
There are 2 cases. But it's an optional feature and can be released.

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.28%. Comparing base (1ca6543) to head (2f29c23).
Report is 7 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1994   +/-   ##
=========================================
  Coverage     89.28%   89.28%           
  Complexity     8058     8058           
=========================================
  Files           232      232           
  Lines         24534    24534           
=========================================
  Hits          21905    21905           
  Misses         2629     2629           
Flag Coverage Δ
5-max 89.28% <100.00%> (ø)
7.4 89.28% <100.00%> (ø)
agnostic 68.57% <100.00%> (+1.12%) ⬆️
mysql 69.83% <100.00%> (ø)
pgsql 69.87% <100.00%> (ø)
sqlite 67.81% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gechetspr gechetspr merged commit 2da1345 into propelorm:master Mar 29, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants